package com.score.controller;

import com.score.pojo.ReturnEntry;
import com.score.pojo.TFiveone;
import com.score.service.impl.FiveoneServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FiveoneController {
    @Autowired
    private FiveoneServiceImpl fiveoneService;

    /**
     * 学生提交五个一作业
     *
     * @param fiveone
     * @return
     */
    @Secured("ROLE_student")
    @PostMapping("/fiveone/send")
    public ReturnEntry sendFiveone(TFiveone fiveone) {
        return fiveoneService.sendFiveone(fiveone);
    }

    /**
     * 老师获取五个一作业
     * @param position
     * @param college
     * @param className
     * @param semester
     * @param workAddress
     * @param currentPage
     * @param pageSize
     * @return
     */
    @Secured({"ROLE_headmaster", "ROLE_instructor", "ROLE_deputySecretary", "ROLE_dean"})
    @PostMapping("/fiveone/teafindfiveone")
    public ReturnEntry teaFindFiveone(String position,
                                      String college,
                                      String className,
                                      String semester,
                                      String workAddress,
                                      Integer currentPage,
                                      Integer pageSize) {
        return fiveoneService.teaFindFiveone(position,college,className,semester,workAddress,currentPage,pageSize);
    }
}
